package com.cimr.comm.service;


import com.cimr.comm.po.User;

import java.util.List;

/**
 * @author liqi on 2017-05-26.
 */
public interface UserService {
    User getByUsername(String username);

//    Set<String> getRoles(String username);
//
//    Set<String> getPermissions(String username);

    /**
     * 取用户数据(用于登录认证)
     * @param username
     * @param pswd
     * @return
     */
    User login(String username, String pswd);

    List<User> selectList(String name, String[] groupIds);

    List<User> getListByUserType(String userType);

    User getUserById(String id);

    int insertUser(String userId,
                          String username,
                          String pswd,
                          int status,
                          String name,
                          String phone,
                          String email,
                          String comment,
                          Float orderId,
                          String groupId,
                          String groupName,
                          String theme,
                          String avatar);

    int updateUser(String userId,
                          String username,
                          String pswd,
                          int status,
                          String name,
                          String phone,
                          String email,
                          String comment,
                          Float orderId,
                          String groupId,
                          String groupName,
                          String theme,
                          String avatar);

    int updateUserTheme(String userId, String theme);

    int deleteUser(String id);

    int saveUserAndRoles(String userId, String[] roleIds);

    /**
     * 验证用户名密码是否正确
     * @param username
     * @param password
     * @return
     */
    boolean verifyUsernamePassword(String username, String password);

    /**
     * 修改密码
     * @param username
     * @param password
     * @return
     */
    int modifyPassword(String username, String password);

    /**
     * 修改密码
     * @param username
     * @param oldPassword
     * @param newPassword
     * @return
     */
    int modifyPassword(String username, String oldPassword, String newPassword);

    List<User> getUserListByGroupId(String groupId);
}
